package org.hot100_6.leetcode283;

public class Solution2 {
    public void moveZeroes(int[] nums) {
        int n = nums.length;

        int slow = 0;
        int fast = 0;

        for (; fast < n; fast++) {
            if (nums[fast] != 0) {
                nums[slow] = nums[fast];
                slow++;
            }
        }

        for (int i = slow; i < n; i++) {
            nums[i] = 0;
        }
    }
}
